﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace vJine.Lua.GUI.UI {
    /// <summary>
    /// UC_ProgressBar.xaml 的交互逻辑
    /// </summary>
    public partial class UC_ProgressBar : UserControl {
        public UC_ProgressBar() {
            InitializeComponent();
        }



        [EditorBrowsable(EditorBrowsableState.Always)]
        public double ProgMain {
            get {
                return this._ProgMain;
            }
            set {
                if (value != this._ProgMain) {
                    this._ProgMain = value;
                    this.set_status();
                }
            }
        }
        double _ProgMain = 70;

        [EditorBrowsable(EditorBrowsableState.Always)]
        public double ProgSub {
            get {
                return this._ProgSub;
            }
            set {
                if (value != this._ProgSub) {
                    this._ProgSub = value;
                    this.set_status();
                }
            }
        }
        double _ProgSub = 60;

        void set_status() {
            double width = this.ActualWidth;

            double progMain = width * this.ProgMain / 100;
            double progSub = progMain * this.ProgSub / 100;

            this.rtgMain.Margin = new Thickness(progMain, 0, 0, 0);
            this.rtgSub.Margin = new Thickness(progSub, 0, 0, 0);
        }

        private void Rectangle_SizeChanged(object sender, SizeChangedEventArgs e) {
            this.set_status();
        }
    }
}
